package org.cloudie.docs.editor.server;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.cloudie.docs.editor.server.auth.AuthenticationKey;
import org.cloudie.docs.editor.server.auth.AuthenticationManager;
import org.cloudie.docs.editor.server.auth.AuthenticationTokenStore;

/**
 * The servlet for handling file uploads.
 */
public class CloudieUploadServlet extends HttpServlet {
  
  private static final long serialVersionUID = 5392168747322591880L;
  private static final Logger log = Logger.getLogger(CloudieUploadServlet.class.getName());

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
       throws IOException {
	try {
	  AuthenticationManager authManager = new AuthenticationManager(
	      new AuthenticationTokenStore(), AuthenticationKey.getAuthSubKey());
	  authManager.autoPilot(req, resp, true);
	  if (authManager.isAuthenticated()) {
	  }
	} catch(Exception x) {
	  log.log(Level.SEVERE, "Auto-pilot authentication error: "  + x.getMessage(), x);
	}
  }
  
}

